/*    */ package com.yss.sofa.cml.print;
/*    */ 
/*    */ import com.yss.sofa.cml.text.TextLine;
/*    */ import java.util.Arrays;
/*    */ 
/*    */ public class PrintAmount extends PrintTextParagraph
/*    */ {
/*    */   private static final long serialVersionUID = 1L;
/*    */   private Integer scale;
/*    */   private Integer precision;
/*    */   private boolean currency;
/*    */ 
/*    */   public Integer getPrecision()
/*    */   {
/* 20 */     return this.precision;
/*    */   }
/*    */ 
/*    */   public Integer getScale() {
/* 24 */     return this.scale;
/*    */   }
/*    */ 
/*    */   public void setPrecision(Integer precision) {
/* 28 */     this.precision = precision;
/*    */   }
/*    */ 
/*    */   public void setScale(Integer scale) {
/* 32 */     this.scale = scale;
/*    */   }
/*    */ 
/*    */   public void setCurrency(boolean currency) {
/* 36 */     this.currency = currency;
/*    */   }
/*    */ 
/*    */   public boolean isCurrency() {
/* 40 */     return this.currency;
/*    */   }
/*    */ 
/*    */   public <T> void accept(PrintElementVisitor<T> drawVisitor, T arg)
/*    */   {
/* 45 */     drawVisitor.visit(this, arg);
/*    */   }
/*    */ 
/*    */   public String getPrintText() {
/* 49 */     if (this.textLines != null) {
/* 50 */       StringBuilder buff = new StringBuilder();
/* 51 */       for (TextLine textLine : this.textLines) {
/* 52 */         buff.append(replace(textLine.getChars(), new char[] { '\t', '_' }));
/*    */       }
/* 54 */       return buff.toString();
/*    */     }
/* 56 */     return null;
/*    */   }
/*    */ 
/*    */   protected char[] replace(char[] chars, char[] flags) {
/* 60 */     if (chars != null) {
/* 61 */       int length = chars.length;
/* 62 */       int m = flags.length;
/* 63 */       boolean dirty = false;
/* 64 */       int r = 0;
/* 65 */       for (int i = 0; i < length; i++) {
/* 66 */         char ch = chars[i];
/* 67 */         boolean match = false;
/* 68 */         for (int j = 0; j < m; j++) {
/* 69 */           if (ch == flags[j]) {
/* 70 */             match = true;
/*    */           }
/*    */         }
/* 73 */         if (match) {
/* 74 */           dirty = true;
/* 75 */           r++;
/*    */         } else {
/* 77 */           chars[(i - r)] = ch;
/*    */         }
/*    */       }
/* 80 */       return dirty ? Arrays.copyOf(chars, length - r) : chars;
/*    */     }
/* 82 */     return null;
/*    */   }
/*    */ 
/*    */   public String toString() {
/* 86 */     return new StringBuilder().append("PrintAmount@").append(super.toString()).toString();
/*    */   }
/*    */ }

/* Location:           X:\repository\com\yss\sofa\cml\cml-api\1.1.0\cml-api-1.1.0.jar
 * Qualified Name:     com.yss.sofa.cml.print.PrintAmount
 * JD-Core Version:    0.6.0
 */